<?php

class Form_Retrieve extends Zend_Form
{

    public $buttonDecorators = array(
        'ViewHelper',
        array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'block')));

    public function init()
    {
        $this->setMethod(self::METHOD_POST);

        /* this Elements & Other Definitions Here ... */

        $password1 = $this->createElement('password', 'password1');

        $password1->setRequired(true);

        $password1->setLabel('Password');

        $password1->addValidator(new Zend_Validate_Alnum());
        $password1->addValidator(new Zend_Validate_StringLength(6));

        $password1->setAttrib('autocomplete', 'off');
        $this->addElement($password1);

        $password2 = $this->createElement('password', 'password2');
        $password2->setRequired(true);
        $password2->addValidator(new My_Validate_Password('password1'));
        $password2->setAttrib('autocomplete', 'off');
        $password2->setLabel('Retype password');
        $this->addElement($password2);

        $button = $this->createElement('button', 'Confirm', array("label" => "Confirm", "type" => "submit", "class" => "thoughtbot", "decorators" => $this->buttonDecorators));
        $this->addElement($button);

        $hash = $this->createElement('hidden', 'hash');
        $hash->addValidator(new Validate_HashExists());
        $hash->addValidator(new Validate_IpCheck());
        $hash->addValidator(new Validate_ExpireCheck());
        $this->addElement($hash);
    }

}